<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>runtransform</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            >MetaGETA (Metadata Gathering, Extraction and Transformation)</th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Module&nbsp;runtransform
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="runtransform-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="runtransform-module.html">Module runtransform</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment"># -*- coding: latin-1 -*-</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"># Copyright (c) 2009 Australian Government, Department of Environment, Heritage, Water and the Arts</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-comment"># Permission is hereby granted, free of charge, to any person obtaining a copy</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-comment"># of this software and associated documentation files (the "Software"), to deal</tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-comment"># in the Software without restriction, including without limitation the rights</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-comment"># to use, copy, modify, merge, publish, distribute, sublicense, and/or sell</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-comment"># copies of the Software, and to permit persons to whom the Software is</tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-comment"># furnished to do so, subject to the following conditions:</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-comment"># The above copyright notice and this permission notice shall be included in</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-comment"># all copies or substantial portions of the Software.</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-comment"># THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-comment"># IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-comment"># FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-comment"># AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-comment"># LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-comment"># OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-comment"># THE SOFTWARE.</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt class="py-docstring">'''</tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-docstring">Metadata Transforms</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-docstring">===================</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt class="py-docstring">Script to run the Metadata Transforms.</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"><tt class="py-docstring">Contains code to show GUI to gather input arguments when none are provided.</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-docstring">To run, call the eponymous batch file which sets the required environment variables.</tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-docstring">Usage::</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-docstring">    runtransform.bat -x xls -t xsl -d dir</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line"><tt class="py-docstring">@newfield sysarg: Argument, Arguments</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line"><tt class="py-docstring">@sysarg: C{-x xls}: MS Excel spreadsheet to read from</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line"><tt class="py-docstring">@sysarg: C{-t xsl}: XSL transform - may be one of the pre-defined XSL transforms or a path to a custom XSL file.</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line"><tt class="py-docstring">@sysarg: C{-d dir}: Directory to write XML files to.</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line"><tt class="py-docstring">@note:B{Additional metadata elements}</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line"><tt class="py-docstring">      The ANZLIC ISO19139 stylesheet can make use of additional metadata elements that may be </tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line"><tt class="py-docstring">      manually added to the Excel spreadsheet and will be included in the output XML/MEF metadata.</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"><tt class="py-docstring">      See the L{transforms} module documentation for more information.</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"><tt class="py-docstring"> </tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line"><tt class="py-docstring">@todo: Set up logging &amp; debug properly. Enable selecting if MEF is created regardless of whether overviews exist</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line"><tt class="py-docstring">@todo: Fix the splashscreen, it's conflicting with the GetArgs GUI and needs to be sorted out - low priority...</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line"><tt class="py-docstring">'''</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line"> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line"><tt class="py-comment">#Imports</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">os</tt><tt class="py-op">,</tt><tt class="py-name">sys</tt><tt class="py-op">,</tt><tt class="py-name">glob</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line"><tt class="py-comment">#Set up the splash screen. Importing the FT.Xml module takes forever...</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line"><tt class="py-comment">#Commented out as it's conflicting with the GetArgs GUI and needs to be sorted out - low priority...</tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line"><tt class="py-comment">#from splashscreen import SplashScreen,CallBack</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line"><tt class="py-comment">#startup=CallBack()</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line"><tt class="py-comment">#if len(sys.argv) == 1:SplashScreen(callback=startup.check)</tt> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line"><tt class="py-comment">#from Tkinter import *</tt> </tt>
<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">Tkinter</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">tkFileDialog</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">Ft</tt><tt class="py-op">.</tt><tt class="py-name">Xml</tt> <tt class="py-keyword">import</tt> <tt class="py-name">Domlette</tt> <tt class="py-keyword">as</tt> <tt class="py-name">Dom</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-0" class="py-name" targets="Module utilities=utilities-module.html"><a title="utilities" class="py-name" href="#" onclick="return doclink('link-0', 'utilities', 'link-0');">utilities</a></tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-1" class="py-name" targets="Package transforms=transforms-module.html,Variable transforms.transforms=transforms-module.html#transforms"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-1', 'transforms', 'link-1');">transforms</a></tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-2" class="py-name" targets="Module progresslogger=progresslogger-module.html"><a title="progresslogger" class="py-name" href="#" onclick="return doclink('link-2', 'progresslogger', 'link-2');">progresslogger</a></tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line"><tt class="py-comment">#Turn off the splashscreen</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line"><tt class="py-comment">#startup.value=True</tt> </tt>
<a name="main"></a><div id="main-def"><a name="L65"></a><tt class="py-lineno"> 65</tt> <a class="py-toggle" href="#" id="main-toggle" onclick="return toggle('main');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="runtransform-module.html#main">main</a><tt class="py-op">(</tt><tt class="py-param">xls</tt><tt class="py-op">,</tt><tt class="py-param">xsl</tt><tt class="py-op">,</tt><tt class="py-param">dir</tt><tt class="py-op">,</tt><tt class="py-param">mef</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt><tt class="py-param">log</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt><tt class="py-param">debug</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt><tt class="py-param">gui</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="main-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="main-expanded"><a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line">    <tt class="py-string">'''</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line"><tt class="py-string">    Run the Metadata Transform</tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line"><tt class="py-string">    @type  xls: C{str}</tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line"><tt class="py-string">    @param xls: Excel spreadsheet to read metadata from</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line"><tt class="py-string">    @type  xsl: C{str}</tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line"><tt class="py-string">    @param xsl: XSL transform {*.xsl|%s}</tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line"><tt class="py-string">    @type  dir: C{str}</tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line"><tt class="py-string">    @param dir: The directory to output metadata XML to</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line"><tt class="py-string">    @type  mef: C{boolean}</tt> </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line"><tt class="py-string">    @param mef: Create Metadata Exchange Format (MEF) file</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line"><tt class="py-string">    @type  log: C{boolean}</tt> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line"><tt class="py-string">    @param log: Log file</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line"><tt class="py-string">    @type  debug: C{boolean}</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line"><tt class="py-string">    @param debug: Turn debug output on</tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line"><tt class="py-string">    @type  gui: C{boolean}</tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line"><tt class="py-string">    @param gui: Show the GUI progress dialog [Not yet implemented]</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line"><tt class="py-string">    '''</tt> <tt class="py-op">%</tt> <tt class="py-string">'|'</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt class="py-string">'"%s"'</tt><tt class="py-op">%</tt><tt class="py-name">s</tt> <tt class="py-keyword">for</tt> <tt class="py-name">s</tt> <tt class="py-keyword">in</tt> <tt id="link-3" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-3', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt id="link-4" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-4', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt class="py-name">keys</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt id="link-5" class="py-name" targets="Variable formats.debug=formats-module.html#debug,Variable geometry.debug=geometry-module.html#debug"><a title="formats.debug
geometry.debug" class="py-name" href="#" onclick="return doclink('link-5', 'debug', 'link-5');">debug</a></tt><tt class="py-op">:</tt><tt class="py-name">level</tt><tt class="py-op">=</tt><tt id="link-6" class="py-name"><a title="progresslogger" class="py-name" href="#" onclick="return doclink('link-6', 'progresslogger', 'link-2');">progresslogger</a></tt><tt class="py-op">.</tt><tt id="link-7" class="py-name" targets="Variable progresslogger.DEBUG=progresslogger-module.html#DEBUG"><a title="progresslogger.DEBUG" class="py-name" href="#" onclick="return doclink('link-7', 'DEBUG', 'link-7');">DEBUG</a></tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt><tt class="py-name">level</tt><tt class="py-op">=</tt><tt id="link-8" class="py-name"><a title="progresslogger" class="py-name" href="#" onclick="return doclink('link-8', 'progresslogger', 'link-2');">progresslogger</a></tt><tt class="py-op">.</tt><tt id="link-9" class="py-name" targets="Variable progresslogger.INFO=progresslogger-module.html#INFO"><a title="progresslogger.INFO" class="py-name" href="#" onclick="return doclink('link-9', 'INFO', 'link-9');">INFO</a></tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line">    <tt class="py-name">windowicon</tt><tt class="py-op">=</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">environ</tt><tt class="py-op">[</tt><tt class="py-string">'CURDIR'</tt><tt class="py-op">]</tt><tt class="py-op">+</tt><tt class="py-string">'/lib/wm_icon.ico'</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">    <tt class="py-keyword">try</tt><tt class="py-op">:</tt><tt class="py-name">pl</tt> <tt class="py-op">=</tt> <tt id="link-10" class="py-name"><a title="progresslogger" class="py-name" href="#" onclick="return doclink('link-10', 'progresslogger', 'link-2');">progresslogger</a></tt><tt class="py-op">.</tt><tt id="link-11" class="py-name" targets="Class progresslogger.ProgressLogger=progresslogger.ProgressLogger-class.html"><a title="progresslogger.ProgressLogger" class="py-name" href="#" onclick="return doclink('link-11', 'ProgressLogger', 'link-11');">ProgressLogger</a></tt><tt class="py-op">(</tt><tt class="py-string">'Metadata Transforms'</tt><tt class="py-op">,</tt> <tt class="py-name">logToConsole</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">,</tt> <tt class="py-name">logToFile</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-name">logToGUI</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-name">level</tt><tt class="py-op">=</tt><tt class="py-name">level</tt><tt class="py-op">,</tt> <tt class="py-name">windowicon</tt><tt class="py-op">=</tt><tt class="py-name">windowicon</tt><tt class="py-op">)</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">    <tt class="py-keyword">except</tt><tt class="py-op">:</tt><tt class="py-name">pl</tt> <tt class="py-op">=</tt> <tt id="link-12" class="py-name"><a title="progresslogger" class="py-name" href="#" onclick="return doclink('link-12', 'progresslogger', 'link-2');">progresslogger</a></tt><tt class="py-op">.</tt><tt id="link-13" class="py-name"><a title="progresslogger.ProgressLogger" class="py-name" href="#" onclick="return doclink('link-13', 'ProgressLogger', 'link-11');">ProgressLogger</a></tt><tt class="py-op">(</tt><tt class="py-string">'Metadata Transforms'</tt><tt class="py-op">,</tt> <tt class="py-name">logToConsole</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">,</tt> <tt class="py-name">logToFile</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-name">logToGUI</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-name">level</tt><tt class="py-op">=</tt><tt class="py-name">level</tt><tt class="py-op">)</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">rec</tt> <tt class="py-keyword">in</tt> <tt id="link-14" class="py-name"><a title="utilities" class="py-name" href="#" onclick="return doclink('link-14', 'utilities', 'link-0');">utilities</a></tt><tt class="py-op">.</tt><tt id="link-15" class="py-name" targets="Class utilities.ExcelReader=utilities.ExcelReader-class.html"><a title="utilities.ExcelReader" class="py-name" href="#" onclick="return doclink('link-15', 'ExcelReader', 'link-15');">ExcelReader</a></tt><tt class="py-op">(</tt><tt class="py-name">xls</tt><tt class="py-op">,</tt> <tt class="py-name">list</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line">            <tt id="link-16" class="py-name" targets="Module overviews=overviews-module.html"><a title="overviews" class="py-name" href="#" onclick="return doclink('link-16', 'overviews', 'link-16');">overviews</a></tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">val</tt> <tt class="py-keyword">in</tt> <tt class="py-name">rec</tt><tt class="py-op">:</tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">==</tt><tt class="py-string">'filename'</tt><tt class="py-op">:</tt><tt class="py-name">filename</tt><tt class="py-op">=</tt><tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">                <tt class="py-keyword">elif</tt> <tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">==</tt><tt class="py-string">'guid'</tt><tt class="py-op">:</tt><tt class="py-name">guid</tt><tt class="py-op">=</tt><tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line">                <tt class="py-keyword">elif</tt> <tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-keyword">in</tt> <tt class="py-op">[</tt><tt class="py-string">'quicklook'</tt><tt class="py-op">,</tt><tt class="py-string">'thumbnail'</tt><tt class="py-op">]</tt> <tt class="py-keyword">and</tt> <tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> <tt class="py-op">!=</tt> <tt class="py-string">''</tt><tt class="py-op">:</tt><tt id="link-17" class="py-name"><a title="overviews" class="py-name" href="#" onclick="return doclink('link-17', 'overviews', 'link-16');">overviews</a></tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">val</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">            <tt class="py-name">strxml</tt><tt class="py-op">=</tt><tt id="link-18" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-18', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt id="link-19" class="py-name" targets="Function transforms.ListToXML()=transforms-module.html#ListToXML"><a title="transforms.ListToXML" class="py-name" href="#" onclick="return doclink('link-19', 'ListToXML', 'link-19');">ListToXML</a></tt><tt class="py-op">(</tt><tt class="py-name">rec</tt><tt class="py-op">,</tt><tt class="py-string">'crawlresult'</tt><tt class="py-op">)</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line">            <tt class="py-name">xmlfile</tt><tt class="py-op">=</tt><tt class="py-string">'%s/%s.%s.xml'</tt><tt class="py-op">%</tt><tt class="py-op">(</tt><tt class="py-name">dir</tt><tt class="py-op">,</tt><tt class="py-name">filename</tt><tt class="py-op">,</tt><tt class="py-name">guid</tt><tt class="py-op">)</tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">            <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt id="link-20" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-20', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt id="link-21" class="py-name" targets="Function transforms.Transform()=transforms-module.html#Transform"><a title="transforms.Transform" class="py-name" href="#" onclick="return doclink('link-21', 'Transform', 'link-21');">Transform</a></tt><tt class="py-op">(</tt><tt class="py-name">strxml</tt><tt class="py-op">,</tt> <tt class="py-name">xsl</tt><tt class="py-op">,</tt> <tt class="py-name">xmlfile</tt><tt class="py-op">)</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt id="link-22" class="py-name"><a title="overviews" class="py-name" href="#" onclick="return doclink('link-22', 'overviews', 'link-16');">overviews</a></tt><tt class="py-op">:</tt><tt id="link-23" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-23', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt id="link-24" class="py-name" targets="Function transforms.CreateMEF()=transforms-module.html#CreateMEF"><a title="transforms.CreateMEF" class="py-name" href="#" onclick="return doclink('link-24', 'CreateMEF', 'link-24');">CreateMEF</a></tt><tt class="py-op">(</tt><tt class="py-name">dir</tt><tt class="py-op">,</tt><tt class="py-name">xmlfile</tt><tt class="py-op">,</tt><tt class="py-name">guid</tt><tt class="py-op">,</tt><tt id="link-25" class="py-name"><a title="overviews" class="py-name" href="#" onclick="return doclink('link-25', 'overviews', 'link-16');">overviews</a></tt><tt class="py-op">)</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">            <tt class="py-name">pl</tt><tt class="py-op">.</tt><tt class="py-name">info</tt><tt class="py-op">(</tt><tt class="py-string">'Transformed metadata for '</tt> <tt class="py-op">+</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">Exception</tt><tt class="py-op">,</tt><tt class="py-name">err</tt><tt class="py-op">:</tt> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-string">'message instruction'</tt> <tt class="py-keyword">in</tt> <tt class="py-name">err</tt><tt class="py-op">.</tt><tt class="py-name">args</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line">                <tt class="py-name">pl</tt><tt class="py-op">.</tt><tt class="py-name">info</tt><tt class="py-op">(</tt><tt class="py-string">''</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">err</tt><tt class="py-op">.</tt><tt class="py-name">args</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">strip</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line">                <tt class="py-name">pl</tt><tt class="py-op">.</tt><tt class="py-name">error</tt><tt class="py-op">(</tt><tt class="py-string">'%s\n%s'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">,</tt> <tt id="link-26" class="py-name"><a title="utilities" class="py-name" href="#" onclick="return doclink('link-26', 'utilities', 'link-0');">utilities</a></tt><tt class="py-op">.</tt><tt id="link-27" class="py-name" targets="Function utilities.ExceptionInfo()=utilities-module.html#ExceptionInfo"><a title="utilities.ExceptionInfo" class="py-name" href="#" onclick="return doclink('link-27', 'ExceptionInfo', 'link-27');">ExceptionInfo</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">                <tt class="py-name">pl</tt><tt class="py-op">.</tt><tt id="link-28" class="py-name"><a title="formats.debug
geometry.debug" class="py-name" href="#" onclick="return doclink('link-28', 'debug', 'link-5');">debug</a></tt><tt class="py-op">(</tt><tt id="link-29" class="py-name"><a title="utilities" class="py-name" href="#" onclick="return doclink('link-29', 'utilities', 'link-0');">utilities</a></tt><tt class="py-op">.</tt><tt id="link-30" class="py-name"><a title="utilities.ExceptionInfo" class="py-name" href="#" onclick="return doclink('link-30', 'ExceptionInfo', 'link-27');">ExceptionInfo</a></tt><tt class="py-op">(</tt><tt class="py-number">10</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">         </tt>
<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line"><tt class="py-comment">##    for rec in utilities.ExcelReader(xls):</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line"><tt class="py-comment">##        try:</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line"><tt class="py-comment">##            strxml=transforms.DictToXML(rec,'crawlresult')</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line"><tt class="py-comment">##            result = transforms.Transform(strxml, xsl, '%s/%s.%s.xml'%(dir,rec['filename'],rec['guid']))</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line"><tt class="py-comment">##            pl.info('Transformed metadata for ' +rec['filename'])</tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line"><tt class="py-comment">##        except Exception,err:</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line"><tt class="py-comment">##            pl.error('%s\n%s' % (rec['filename'], utilities.ExceptionInfo()))</tt> </tt>
<a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line"><tt class="py-comment">##            pl.debug(utilities.ExceptionInfo(10))</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line"> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line"> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line"><tt class="py-comment">#========================================================================================================</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-name">__name__</tt> <tt class="py-op">==</tt> <tt class="py-string">'__main__'</tt><tt class="py-op">:</tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line">    <tt class="py-comment">#To ensure uri's work...</tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">basename</tt><tt class="py-op">(</tt><tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">!=</tt><tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">chdir</tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">dirname</tt><tt class="py-op">(</tt><tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line">    <tt class="py-keyword">import</tt> <tt class="py-name">optparse</tt><tt class="py-op">,</tt><tt id="link-31" class="py-name" targets="Module icons=icons-module.html"><a title="icons" class="py-name" href="#" onclick="return doclink('link-31', 'icons', 'link-31');">icons</a></tt><tt class="py-op">,</tt><tt id="link-32" class="py-name" targets="Module getargs=getargs-module.html"><a title="getargs" class="py-name" href="#" onclick="return doclink('link-32', 'getargs', 'link-32');">getargs</a></tt> </tt>
<a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line">    <tt class="py-name">description</tt><tt class="py-op">=</tt><tt class="py-string">'Transform metadata to XML'</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line">    <tt class="py-name">parser</tt> <tt class="py-op">=</tt> <tt class="py-name">optparse</tt><tt class="py-op">.</tt><tt class="py-name">OptionParser</tt><tt class="py-op">(</tt><tt class="py-name">description</tt><tt class="py-op">=</tt><tt class="py-name">description</tt><tt class="py-op">)</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line"> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">=</tt><tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"-x"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"xls"</tt><tt class="py-op">,</tt> <tt class="py-name">metavar</tt><tt class="py-op">=</tt><tt class="py-string">"xls"</tt><tt class="py-op">,</tt> <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"Excel spreadsheet"</tt><tt class="py-op">)</tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line">    <tt class="py-name">xlsarg</tt><tt class="py-op">=</tt><tt id="link-33" class="py-name"><a title="getargs" class="py-name" href="#" onclick="return doclink('link-33', 'getargs', 'link-32');">getargs</a></tt><tt class="py-op">.</tt><tt id="link-34" class="py-name" targets="Class getargs.FileArg=getargs.FileArg-class.html"><a title="getargs.FileArg" class="py-name" href="#" onclick="return doclink('link-34', 'FileArg', 'link-34');">FileArg</a></tt><tt class="py-op">(</tt><tt class="py-name">opt</tt><tt class="py-op">,</tt><tt class="py-name">filter</tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt class="py-op">(</tt><tt class="py-string">'Excel Spreadsheet'</tt><tt class="py-op">,</tt><tt class="py-string">'*.xls'</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">icon</tt><tt class="py-op">=</tt><tt id="link-35" class="py-name"><a title="icons" class="py-name" href="#" onclick="return doclink('link-35', 'icons', 'link-31');">icons</a></tt><tt class="py-op">.</tt><tt id="link-36" class="py-name" targets="Class icons.xls_img=icons.xls_img-class.html"><a title="icons.xls_img" class="py-name" href="#" onclick="return doclink('link-36', 'xls_img', 'link-36');">xls_img</a></tt><tt class="py-op">)</tt> </tt>
<a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line">    <tt class="py-name">xlsarg</tt><tt class="py-op">.</tt><tt class="py-name">tooltip</tt><tt class="py-op">=</tt><tt class="py-string">"Excel spreadsheet to read metadata from"</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line"> </tt>
<a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">=</tt><tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">'-d'</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"dir"</tt><tt class="py-op">,</tt> <tt class="py-name">metavar</tt><tt class="py-op">=</tt><tt class="py-string">"dir"</tt><tt class="py-op">,</tt> <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">'Output directory'</tt><tt class="py-op">)</tt> </tt>
<a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">.</tt><tt class="py-name">icon</tt><tt class="py-op">=</tt><tt id="link-37" class="py-name"><a title="icons" class="py-name" href="#" onclick="return doclink('link-37', 'icons', 'link-31');">icons</a></tt><tt class="py-op">.</tt><tt id="link-38" class="py-name" targets="Class icons.dir_img=icons.dir_img-class.html"><a title="icons.dir_img" class="py-name" href="#" onclick="return doclink('link-38', 'dir_img', 'link-38');">dir_img</a></tt> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line">    <tt class="py-name">dirarg</tt><tt class="py-op">=</tt><tt id="link-39" class="py-name"><a title="getargs" class="py-name" href="#" onclick="return doclink('link-39', 'getargs', 'link-32');">getargs</a></tt><tt class="py-op">.</tt><tt id="link-40" class="py-name" targets="Class getargs.DirArg=getargs.DirArg-class.html"><a title="getargs.DirArg" class="py-name" href="#" onclick="return doclink('link-40', 'DirArg', 'link-40');">DirArg</a></tt><tt class="py-op">(</tt><tt class="py-name">opt</tt><tt class="py-op">,</tt><tt class="py-name">initialdir</tt><tt class="py-op">=</tt><tt class="py-string">''</tt><tt class="py-op">,</tt><tt id="link-41" class="py-name" targets="Variable getargs.Arg.enabled=getargs.Arg-class.html#enabled"><a title="getargs.Arg.enabled" class="py-name" href="#" onclick="return doclink('link-41', 'enabled', 'link-41');">enabled</a></tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">,</tt><tt class="py-name">icon</tt><tt class="py-op">=</tt><tt id="link-42" class="py-name"><a title="icons" class="py-name" href="#" onclick="return doclink('link-42', 'icons', 'link-31');">icons</a></tt><tt class="py-op">.</tt><tt id="link-43" class="py-name"><a title="icons.dir_img" class="py-name" href="#" onclick="return doclink('link-43', 'dir_img', 'link-38');">dir_img</a></tt><tt class="py-op">,</tt><tt class="py-name">tooltip</tt><tt class="py-op">=</tt><tt class="py-string">'Tooltip!'</tt><tt class="py-op">)</tt> </tt>
<a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line">    <tt class="py-name">dirarg</tt><tt class="py-op">.</tt><tt class="py-name">tooltip</tt><tt class="py-op">=</tt><tt class="py-string">'The directory to output metadata XML to'</tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line">     </tt>
<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">=</tt><tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"-t"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"xsl"</tt><tt class="py-op">,</tt> <tt class="py-name">metavar</tt><tt class="py-op">=</tt><tt class="py-string">"xsl"</tt><tt class="py-op">,</tt> <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"XSL transform"</tt><tt class="py-op">)</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line">    <tt class="py-name">xslarg</tt><tt class="py-op">=</tt><tt id="link-44" class="py-name"><a title="getargs" class="py-name" href="#" onclick="return doclink('link-44', 'getargs', 'link-32');">getargs</a></tt><tt class="py-op">.</tt><tt id="link-45" class="py-name" targets="Class getargs.ComboBoxArg=getargs.ComboBoxArg-class.html"><a title="getargs.ComboBoxArg" class="py-name" href="#" onclick="return doclink('link-45', 'ComboBoxArg', 'link-45');">ComboBoxArg</a></tt><tt class="py-op">(</tt><tt class="py-name">opt</tt><tt class="py-op">,</tt><tt class="py-name">icon</tt><tt class="py-op">=</tt><tt id="link-46" class="py-name"><a title="icons" class="py-name" href="#" onclick="return doclink('link-46', 'icons', 'link-31');">icons</a></tt><tt class="py-op">.</tt><tt id="link-47" class="py-name"><a title="icons.xls_img" class="py-name" href="#" onclick="return doclink('link-47', 'xls_img', 'link-36');">xls_img</a></tt><tt class="py-op">)</tt> </tt>
<a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line">    <tt class="py-name">xslarg</tt><tt class="py-op">.</tt><tt class="py-name">tooltip</tt><tt class="py-op">=</tt><tt class="py-string">"XSL transform {*.xsl|%s}"</tt> <tt class="py-op">%</tt> <tt class="py-string">'|'</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt class="py-string">'"%s"'</tt><tt class="py-op">%</tt><tt class="py-name">s</tt> <tt class="py-keyword">for</tt> <tt class="py-name">s</tt> <tt class="py-keyword">in</tt> <tt id="link-48" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-48', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt id="link-49" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-49', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt class="py-name">keys</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line">    <tt class="py-name">xslarg</tt><tt class="py-op">.</tt><tt class="py-name">options</tt><tt class="py-op">=</tt><tt id="link-50" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-50', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt id="link-51" class="py-name"><a title="transforms
transforms.transforms" class="py-name" href="#" onclick="return doclink('link-51', 'transforms', 'link-1');">transforms</a></tt><tt class="py-op">.</tt><tt class="py-name">keys</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line"> </tt>
<a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">=</tt><tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"-m"</tt><tt class="py-op">,</tt> <tt class="py-name">action</tt><tt class="py-op">=</tt><tt class="py-string">"store_true"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"mef"</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt>    </tt>
<a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line">                     <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"Create Metadata Exchange Format (MEF) file"</tt><tt class="py-op">)</tt> </tt>
<a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">=</tt><tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"--debug"</tt><tt class="py-op">,</tt> <tt class="py-name">action</tt><tt class="py-op">=</tt><tt class="py-string">"store_true"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"debug"</tt><tt class="py-op">,</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"Turn debug output on"</tt><tt class="py-op">)</tt> </tt>
<a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">=</tt><tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"-l"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"log"</tt><tt class="py-op">,</tt> <tt class="py-name">metavar</tt><tt class="py-op">=</tt><tt class="py-string">"log"</tt><tt class="py-op">,</tt>                             </tt>
<a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line">                      <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-name">optparse</tt><tt class="py-op">.</tt><tt class="py-name">SUPPRESS_HELP</tt><tt class="py-op">)</tt> <tt class="py-comment">#help="Log file")                     #Not yet implemented</tt> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line">    <tt class="py-name">opt</tt><tt class="py-op">=</tt><tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"--gui"</tt><tt class="py-op">,</tt> <tt class="py-name">action</tt><tt class="py-op">=</tt><tt class="py-string">"store_true"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"gui"</tt><tt class="py-op">,</tt> <tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> </tt>
<a name="L145"></a><tt class="py-lineno">145</tt>  <tt class="py-line">                      <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-name">optparse</tt><tt class="py-op">.</tt><tt class="py-name">SUPPRESS_HELP</tt><tt class="py-op">)</tt> <tt class="py-comment">#help="Show the GUI progress dialog") #Not yet implemented</tt> </tt>
<a name="L146"></a><tt class="py-lineno">146</tt>  <tt class="py-line"> </tt>
<a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line">    <tt class="py-name">optvals</tt><tt class="py-op">,</tt><tt class="py-name">argvals</tt> <tt class="py-op">=</tt> <tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">parse_args</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L148"></a><tt class="py-lineno">148</tt>  <tt class="py-line"> </tt>
<a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line">    <tt class="py-comment">#Do we need to pop up the GUI?</tt> </tt>
<a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">dir</tt> <tt class="py-keyword">or</tt> <tt class="py-keyword">not</tt> <tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">xls</tt> <tt class="py-keyword">or</tt> <tt class="py-keyword">not</tt> <tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">xsl</tt><tt class="py-op">:</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line">        <tt class="py-comment">#Add existing command line args values to opt default values so they show in the gui</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">opt</tt> <tt class="py-keyword">in</tt> <tt class="py-name">parser</tt><tt class="py-op">.</tt><tt class="py-name">option_list</tt><tt class="py-op">:</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line">            <tt class="py-name">opt</tt><tt class="py-op">.</tt><tt class="py-name">default</tt><tt class="py-op">=</tt><tt class="py-name">vars</tt><tt class="py-op">(</tt><tt class="py-name">optvals</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt class="py-name">opt</tt><tt class="py-op">.</tt><tt class="py-name">dest</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt> </tt>
<a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line">        <tt class="py-comment">#Pop up the GUI</tt> </tt>
<a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line">        <tt class="py-name">args</tt><tt class="py-op">=</tt><tt id="link-52" class="py-name"><a title="getargs" class="py-name" href="#" onclick="return doclink('link-52', 'getargs', 'link-32');">getargs</a></tt><tt class="py-op">.</tt><tt id="link-53" class="py-name" targets="Class getargs.GetArgs=getargs.GetArgs-class.html"><a title="getargs.GetArgs" class="py-name" href="#" onclick="return doclink('link-53', 'GetArgs', 'link-53');">GetArgs</a></tt><tt class="py-op">(</tt><tt class="py-name">dirarg</tt><tt class="py-op">,</tt><tt class="py-name">xlsarg</tt><tt class="py-op">,</tt><tt class="py-name">xslarg</tt><tt class="py-op">)</tt> </tt>
<a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">args</tt><tt class="py-op">:</tt><tt class="py-comment">#GetArgs returns None if user cancels the GUI</tt> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt>  <tt class="py-line">            <tt id="link-54" class="py-name" targets="Function runcrawler.main()=runcrawler-module.html#main,Function runtransform.main()=runtransform-module.html#main"><a title="runcrawler.main
runtransform.main" class="py-name" href="#" onclick="return doclink('link-54', 'main', 'link-54');">main</a></tt><tt class="py-op">(</tt><tt class="py-name">args</tt><tt class="py-op">.</tt><tt class="py-name">xls</tt><tt class="py-op">,</tt><tt class="py-name">args</tt><tt class="py-op">.</tt><tt class="py-name">xsl</tt><tt class="py-op">,</tt><tt class="py-name">args</tt><tt class="py-op">.</tt><tt class="py-name">dir</tt><tt class="py-op">,</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">log</tt><tt class="py-op">,</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">gui</tt><tt class="py-op">,</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt id="link-55" class="py-name"><a title="formats.debug
geometry.debug" class="py-name" href="#" onclick="return doclink('link-55', 'debug', 'link-5');">debug</a></tt><tt class="py-op">)</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt> <tt class="py-comment">#No need for the GUI</tt> </tt>
<a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line">        <tt id="link-56" class="py-name"><a title="runcrawler.main
runtransform.main" class="py-name" href="#" onclick="return doclink('link-56', 'main', 'link-54');">main</a></tt><tt class="py-op">(</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">xls</tt><tt class="py-op">,</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">xsl</tt><tt class="py-op">,</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">dir</tt><tt class="py-op">,</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">log</tt><tt class="py-op">,</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt class="py-name">gui</tt><tt class="py-op">,</tt><tt class="py-name">optvals</tt><tt class="py-op">.</tt><tt id="link-57" class="py-name"><a title="formats.debug
geometry.debug" class="py-name" href="#" onclick="return doclink('link-57', 'debug', 'link-5');">debug</a></tt><tt class="py-op">)</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            >MetaGETA (Metadata Gathering, Extraction and Transformation)</th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    &nbsp;
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
